export default {
  namespaced: true,

  state: {
    id: null,
    title: null,
    clz: null,
    key: null,
    icon: null,
    isLeaf: false,
    expanded: false
  },

  mutations: {
    setId(state, id) {
      state.id = id;
    },
    setTitle(state, title) {
      state.title = title;
    },
    setClz(state, clz) {
      state.clz = clz;
    },
    setKey(state, key) {
      state.key = key;
    },
    setIcon(state, icon) {
      state.icon = icon;
    },
    setIsLeaf(state, isLeaf) {
      state.isLeaf = isLeaf;
    },
    setExpanded(state, expanded) {
      state.expanded = expanded;
    }
  },

  actions: {
    setData({ commit }, { data }) {
      commit('setId', data.id);
      commit('setTitle', data.title);
      commit('setClz', data.clz);
      commit('setKey', data.key);
      commit('setIcon', data.icon);
      commit('setIsLeaf', data.isLeaf);
      commit('setExpanded', data.expanded);
    }
  }
};
